﻿using Microsoft.Xna.Framework.Input.Touch;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;
using ProtectThePieWP7.AdditionalClasses;
using ThreeThingGame;

namespace ProtectThePie
{
    public class GameOver
    {
        private Point fieldSize;
        private MenuSystem menu;

        public GameOver(Point fieldSize)
        {
            this.fieldSize = fieldSize;

            //menu = new MenuSystem();
            menu.AddMenuEntry("Main menu", MenuEntryType.link);
        }

        public bool Draw(SpriteBatch spriteBatch)
        {
            //Draw Menu
            menu.Draw(spriteBatch);

            //Draw String
            //spriteBatch.DrawString(Game1.mainFont, "   Game Over !", new Vector2(fieldSize.X / 4, fieldSize.Y / 2 + 100), Color.Black);

            return true;
        }

        public bool Update(TouchCollection touches)
        {
            // Allows the game to exit to main menu
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
                Game1.state = GameState.MainMenu;

            if (menu.Update(touches) == "Main menu") Game1.state = GameState.MainMenu;

            return true;
        }
    }
}
